﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace Property.DelegateBased
{
    /// <summary>
    /// Default implementation of IImplenemtationMap.
    /// </summary>
    public class DefaultImplementation<TBase>: IImplenemtationMap<TBase>
    {
        public virtual Func<TBaseType, TResult> ImplementGetter<TBaseType, TDeclaringType, TConstructedType, TResult>(PropertyInfo property)
            where TConstructedType : TBaseType, TDeclaringType
            where TBaseType : TBase
        {
            return (i => default(TResult));
        }
        public virtual Action<TBaseType, TResult> ImplementSetter<TBaseType, TDeclaringType, TConstructedType, TResult>(PropertyInfo property)
            where TConstructedType : TBaseType, TDeclaringType
            where TBaseType : TBase
        {
            return (i, v) => { };
        }

        public virtual Func<TBaseType, TResult> OverrideGetter<TBaseType, TDeclaringType, TConstructedType, TResult>(PropertyInfo property) where TBaseType : TBase, TDeclaringType where TConstructedType : TBaseType, TDeclaringType
        {
            return ImplementGetter<TBaseType, TDeclaringType, TConstructedType, TResult>(property);
        }

        public virtual Action<TBaseType, TResult> OverrideSetter<TBaseType, TDeclaringType, TConstructedType, TResult>(PropertyInfo property) where TBaseType : TBase, TDeclaringType where TConstructedType : TBaseType, TDeclaringType
        {
            return ImplementSetter<TBaseType, TDeclaringType, TConstructedType, TResult>(property);
        }
    }
}
